package com.chen.springboot.controller;

import cn.hutool.http.HttpUtil;
import com.chen.springboot.annotation.Limiter;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 请求三方接口
 *
 * @author chenchao
 * @date 2022/6/22 22:48
 */
@RestController
@Api(value = "TripartiteController", tags = "三方接口")
@RequestMapping("/tripartite")
@Async
public class TripartiteController {


    @GetMapping("/team")
    @ApiOperation("球队信息")
    @Limiter(value = 1.0, timeout = 1000)
    public String teamMessage() throws InterruptedException {

        return HttpUtil.get("https://china.nba.cn/stats2/season/conferencestanding.json?");

    }


    @GetMapping("/player")
    @Limiter(value = 1.0, timeout = 1000)
    @ApiOperation("球员信息")
    public String playerMessage() {

        return HttpUtil.get("https://china.nba.cn/stats2/league/playerlist.json");
    }


    @GetMapping("/weather")
    @Limiter(value = 1.0, timeout = 1000)
    @ApiOperation("和风天气")
    public String weatherMessage() {
        return HttpUtil.get("https://free-api.heweather.net/s6/weather/now?location=芜湖&key=bd5c2bbed6ac44b9a504781e436299a8");
    }


    @GetMapping("/dailyNews")
    @Limiter(value = 1.0, timeout = 1000)
    @ApiOperation("NBA每日新闻")
    public String dailyNews() {
        return HttpUtil.get("https://china.nba.cn/cms/v1/news/list?column_id=57&page_size=50&page_no=1");
    }

}
